//登录状态栏
$(function () {
    $.ajax({
        url:"easybuy/isUser",
        dataType:"json",
        async: false,
        success:function (user) {
            sessionStorage.clear();
            if(user!=null){
                sessionStorage.setItem("user",JSON.stringify(user));
                if (user.type==1){
                    $(".fr .fl").first().html("你好，<a href='Member_User.html'>" +user.loginName+"</a>&nbsp; " +
                        "<a href=\"javascript:void(0)\" style=\"color:#ff4e00;\" id='zhuxiao'>注销</a>&nbsp;|&nbsp;" +
                        "<a href='Member_User_List.html'>管理员操作</a>&nbsp;|");
                    $(".ss").remove();
                } else {
                    $(".fr .fl").first().html("你好，<a href='Member_User.html'>" +user.loginName+"</a>&nbsp; " +
                        "<a href=\"javascript:void(0)\" style=\"color:#ff4e00;\" id='zhuxiao'>注销</a>&nbsp;|&nbsp;" +
                        "<a href='Member_Order.html'>我的订单</a>&nbsp;|")
                }
            }else{
                $(".fr .fl").first().html("你好，请<a href='Login.html'>登录</a>&nbsp; <a href='Regist.html' style='color:#ff4e00;'>免费注册</a>&nbsp;|&nbsp;<a href='Login.html'>我的订单</a>&nbsp;|")
            }
        }
    })
})
//注销
$(function () {
    $("#zhuxiao").click(function () {
        if(confirm("是否注销？")){
            sessionStorage.removeItem("user");
            $.ajax({
                url:"easybuy/logout",
                async:false,
                success:function () {
                    alert("注销成功！")
                }
            })
            location.href="Login.html";
        }
    });
})